//
//  CZTempViewController.swift
//  weibo
//
//  Created by Apple on 16/3/9.
//  Copyright © 2016年 KY. All rights reserved.
//

import UIKit

class CZTempViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        view.backgroundColor = UIColor.whiteColor()
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "PUSH", target: self, action: "push")
//        //  设置title显示当前是push进来第几个视图控制器,第一个控制器是首页视图控制器
//        navigationItem.title = "当前显示的是\(navigationController?.viewControllers.count ?? 0)个控制器"
//        //  如果是第二个视图控制器，返回按钮显示的时候第一个控制器的title
//        var title = "返回"
//        if navigationController?.viewControllers.count == 2 {
//            title = navigationController?.viewControllers.first?.title ?? title
//            navigationItem.leftBarButtonItem = UIBarButtonItem(imgName:"navigationbar_back_withtext",title: title, target: self, action: "back")
//        }
//        
//        if navigationController?.viewControllers.count > 2 {
//            navigationItem.leftBarButtonItem = UIBarButtonItem(imgName:"navigationbar_back_withtext",title: title, target: self, action: "back")
//            
//        }
//        
//        
//        //  添加右边的导航按钮
//        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "PUSH", target: self, action: "push")
        
    }
    
    @objc private func push() {
        //  进入临时控制器
        let vc = CZTempViewController()
        navigationController?.pushViewController(vc, animated: true)

    }
    
    
    


  
}
